<?php

namespace App\Http\Controllers\Steam;

use App\DB\Steam\SteamGameTagDB;
use App\Http\Controllers\Controller;
use App\Model\Steam\SteamGameTag;
use Illuminate\Http\Request;

class SteamGameTagController extends Controller
{
    protected $thumbPath = 'upload/image/steam/game/thumb/';
    /**
     * 标签列表
     *
     * @param Request $request
     * @return array
     */
    public function tags(Request $request)
    {
        $respone = [];
        $respone['data'] = SteamGameTag::tagsList();
        return $this->success($respone);
    }

    /**
     * 标签下游戏列表
     *
     * @param Request $request
     */
    public function tagsGames(Request $request)
    {
        if(!$request->has('id')) {
            return $this->error(1, 'No found id!');
        }
        $id = $request->input('id');
        $respone = SteamGameTagDB::getGameByTag($id);
        $respone['thumb_path'] = env('FILE_URL') . $this->thumbPath;
        return $this->success($respone);
    }
}